In [1]:
import numpy as np
import pandas as pd
import scanpy as sc
import scvelo as scv
import muon as mu
import cellrank as cr
In [2]:
from sinfo import sinfo
sinfo(dependencies=True)
The `sinfo` package has changed name and is now called `session_info` to become more discoverable and self-explanatory. The `sinfo` PyPI package will be kept around to avoid breaking old installs and you can downgrade to 0.3.2 if you want to use it without seeing this message. For the latest features and bug fixes, please install `session_info` instead. The usage and defaults also changed slightly, so please review the latest README at https://gitlab.com/joelostblom/session_info. ----- cellrank 2.0.0 muon 0.1.5 numpy 1.22.4 pandas 1.5.3 scanpy 1.9.3 scvelo 0.2.5 sinfo 0.3.4 ----- PIL 10.0.0 anndata 0.8.0 anyio NA arrow 1.2.3 asttokens NA attr 23.1.0 attrs 23.1.0 awkward 2.3.1 awkward_cpp NA babel 2.12.1 backcall 0.2.0 certifi 2023.07.22 cffi 1.15.1 charset_normalizer 3.2.0 comm 0.1.3 cycler 0.10.0 cython_runtime NA dateutil 2.8.2 debugpy 1.6.7 decorator 5.1.1 defusedxml 0.7.1 docrep 0.3.2 executing 1.2.0 fastjsonschema NA fqdn NA h5py 3.9.0 idna 3.4 igraph 0.10.6 ipykernel 6.25.0 ipywidgets 8.0.7 isoduration NA jedi 0.18.2 jinja2 3.0.3 joblib 1.3.1 json5 NA jsonpointer 2.4 jsonschema 4.18.4 jsonschema_specifications NA jupyter_events 0.6.3 jupyter_server 2.7.0 jupyterlab_server 2.24.0 kiwisolver 1.4.4 leidenalg 0.10.1 llvmlite 0.40.1 markupsafe 2.1.3 matplotlib 3.7.1 mpl_toolkits NA mudata 0.2.3 natsort 8.4.0 nbformat 5.9.1 numba 0.57.1 overrides NA packaging 23.1 parso 0.8.3 patsy 0.5.3 pexpect 4.8.0 pickleshare 0.7.5 pkg_resources NA platformdirs 3.9.1 progressbar 4.2.0 prometheus_client NA prompt_toolkit 3.0.39 psutil 5.9.5 ptyprocess 0.7.0 pure_eval 0.2.2 pycparser 2.21 pydev_ipython NA pydevconsole NA pydevd 2.9.5 pydevd_file_utils NA pydevd_plugins NA pydevd_tracing NA pygam 0.8.0 pygments 2.15.1 pygpcca 1.0.4 pynndescent 0.5.10 pyparsing 3.0.9 python_utils NA pythonjsonlogger NA pytz 2023.3 referencing NA requests 2.31.0 rfc3339_validator 0.1.4 rfc3986_validator 0.1.1 rpds NA scipy 1.11.1 seaborn 0.12.2 send2trash NA six 1.16.0 sklearn 1.3.0 sniffio 1.3.0 stack_data 0.6.2 statsmodels 0.14.0 texttable 1.6.7 threadpoolctl 3.2.0 tornado 6.3.2 tqdm 4.65.0 traitlets 5.9.0 typing_extensions NA umap 0.5.3 uri_template NA urllib3 2.0.4 wcwidth 0.2.6 webcolors 1.13 websocket 1.6.1 wrapt 1.15.0 yaml 6.0.1 zmq 25.1.0 zoneinfo NA ----- IPython 8.14.0 jupyter_client 8.3.0 jupyter_core 5.3.1 jupyterlab 4.0.3 notebook 7.0.0 ----- Python 3.10.12 (main, Jul 5 2023, 18:54:27) [GCC 11.2.0] Linux-5.19.0-35-generic-x86_64-with-glibc2.35 96 logical CPU cores, x86_64 ----- Session information updated at 2024-06-20 22:26
In [3]:
scv.set_figure_params(style='scvelo', dpi=100, dpi_save=510, frameon=None, vector_friendly=True,
transparent=True, fontsize=7, figsize=(3,3),
format='pdf', ipython_format='png2x')
In [3]:
bdata2 = sc.read_h5ad('../Hu_Organoid/srt.h5ad')
bdata2
Out[3]:
AnnData object with n_obs × n_vars = 8694 × 25373
obs: 'orig.ident', 'nCount_RNA', 'nFeature_RNA', 'percent.mt', 'percent.ribo', 'nCount_SCT', 'nFeature_SCT', 'SCT_snn_res.0.6', 'seurat_clusters', 'RNA_snn_res.0.6', 'celltype', 'celltype_rev'
var: 'vst.mean', 'vst.variance', 'vst.variance.expected', 'vst.variance.standardized', 'vst.variable'
uns: 'neighbors'
obsm: 'X_harmony', 'X_pca', 'X_umap'
varm: 'HARMONY', 'PCs'
obsp: 'distances'
In [5]:
bdata2.var_names
Out[5]:
Index(['AL627309.1', 'AL627309.5', 'AP006222.2', 'LINC01409', 'FAM87B',
'LINC01128', 'LINC00115', 'FAM41C', 'AL645608.6', 'AL645608.2',
...
'CHRDL1', 'DCX', 'AC006144.2', 'PRR32', 'FHL1', 'SOX3', 'FMR1NB',
'AC236972.4', 'TTTY9B', 'AC023491.2'],
dtype='object', length=25373)
In [6]:
sc.pl.umap(bdata2, color=['orig.ident', 'celltype'])
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:392: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored cax = scatter( /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:392: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored cax = scatter(
In [7]:
col_paired =["#A6CEE3", "#1F78B4", "#B2DF8A", "#33A02C", "#FB9A99", "#E31A1C", "#FDBF6F"]
In [8]:
sc.pl.umap(
bdata2,
color="celltype",
palette={
"AT2 - activated": "#A6CEE3",
"AT2 - mature": "#1F78B4",
"RASC-AT2": "#B2DF8A",
"Proliferating": "#33A02C",
"AT2 intermediate":"#FB9A99",
"Aberrant intermediate":"#E31A1C",
"Basal": "#FDBF6F"
}
)
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:392: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored cax = scatter(
In [9]:
full_feature_marker =[ 'NKX2-1','EPCAM','SCGB3A1','SCGB3A2', 'CEACAM6', 'SFTPB', 'SFTPC', 'SFTPD', 'LAMP3', 'NAPSA','SLC34A2', 'ABCA3','LRRK2','KRT8','CDKN1A', 'KRT17','FGFR2', 'ID2', 'AGER', 'RTKN2','COL4A4', 'MKI67','TP63', 'SLC2A1', 'CA9', 'VEGFA', 'CTNNB1', 'DUSP4', 'XBP1', 'VIM', 'HIF1A', 'EPAS1']
In [4]:
single_markers =['TP63', 'CEACAM6', 'ID2', 'DUSP4', 'VIM','VEGFA', 'LRRK2', 'FGFR2', 'SCGB3A2', 'SFTPC', 'LAMP3', 'MKI67', 'HIF1A', 'EPAS1']
In [12]:
sc.pl.dotplot(bdata2, full_feature_marker, groupby='celltype', standard_scale='var', dendrogram=True, save='organoid_dotplot.pdf')
WARNING: dendrogram data not found (using key=dendrogram_celltype). Running `sc.tl.dendrogram` with default parameters. For fine tuning it is recommended to run `sc.tl.dendrogram` independently. WARNING: saving figure to file figures/dotplot_organoid_dotplot.pdf
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_dotplot.py:749: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap', 'norm' will be ignored dot_ax.scatter(x, y, **kwds)
In [13]:
sc.pl.dotplot(bdata2, single_markers, groupby='celltype', standard_scale='var', dendrogram=True, cmap='viridis', figsize=[6,2], save='skinny_dotplot.pdf')
WARNING: saving figure to file figures/dotplot_skinny_dotplot.pdf
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_dotplot.py:749: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap', 'norm' will be ignored dot_ax.scatter(x, y, **kwds)
In [17]:
b_data_sub = bdata2[bdata2.obs['celltype'].isin(['AT2 - activated', 'AT2 - mature', 'RASC-AT2', 'Proliferating', 'AT2 intermediate','Aberrant intermediate'])]
sc.pl.umap(
b_data_sub,
color="celltype")
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:392: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored cax = scatter(
In [18]:
b_data1 = b_data_sub[b_data_sub.obs['orig.ident'].isin(['Vehicle'])]
b_data2 = b_data_sub[b_data_sub.obs['orig.ident'].isin(['PT-2385'])]
data1_loom = scv.read('../Hu_Organoid/9224_1.loom')
data2_loom = scv.read('../Hu_Organoid/9224_2.loom')
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/anndata/_core/anndata.py:1830: UserWarning: Variable names are not unique. To make them unique, call `.var_names_make_unique`.
utils.warn_names_duplicates("var")
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/anndata/_core/anndata.py:1830: UserWarning: Variable names are not unique. To make them unique, call `.var_names_make_unique`.
utils.warn_names_duplicates("var")
In [19]:
scv.utils.clean_obs_names(b_data1)
scv.utils.clean_obs_names(data1_loom)
scv.utils.clean_obs_names(b_data2)
scv.utils.clean_obs_names(data2_loom)
#data1_loom.var_names_make_unique()
#data2_loom.var_names_make_unique()
In [20]:
shmeta1 = scv.utils.merge(b_data1, data1_loom)
shmeta2 = scv.utils.merge(b_data2, data2_loom)
In [8]:
sc.pl.umap(
shmeta1,
color="celltype",
palette={
"AT2 - activated": "#A6CEE3",
"AT2 - mature": "#1F78B4",
"RASC-AT2": "#B2DF8A",
"Proliferating": "#33A02C",
"AT2 intermediate":"#FB9A99",
"Aberrant intermediate":"#E31A1C",
}
)
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:392: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored cax = scatter(
In [9]:
sc.pl.umap(
shmeta2,
color="celltype",
palette={
"AT2 - activated": "#A6CEE3",
"AT2 - mature": "#1F78B4",
"RASC-AT2": "#B2DF8A",
"Proliferating": "#33A02C",
"AT2 intermediate":"#FB9A99",
"Aberrant intermediate":"#E31A1C",
}
)
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:392: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored cax = scatter(
In [25]:
sc.pl.umap(
shmeta,
color="orig.ident",
palette={
"Vehicle": "#000080",
"PT-2385": "#FFA500"
}
)
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:163: MatplotlibDeprecationWarning: The get_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use ``matplotlib.colormaps[name]`` or ``matplotlib.colormaps.get_cmap(obj)`` instead. cmap = copy(get_cmap(cmap)) /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:392: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored cax = scatter(
In [210]:
sc.pl.embedding(shmeta, basis="umap", color=["orig.ident","celltype"], size=75, add_outline=True, save='total cleaned umap_20230815.pdf')
WARNING: saving figure to file figures/umaptotal cleaned umap_20230815.pdf
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:163: MatplotlibDeprecationWarning: The get_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use ``matplotlib.colormaps[name]`` or ``matplotlib.colormaps.get_cmap(obj)`` instead. cmap = copy(get_cmap(cmap)) /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:369: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored ax.scatter( /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:379: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored ax.scatter( /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:392: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored cax = scatter( /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:369: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored ax.scatter( /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:379: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored ax.scatter( /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scanpy/plotting/_tools/scatterplots.py:392: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored cax = scatter(
In [ ]:
#shmeta1 is VEH
#shmeta2 is PT
In [48]:
#scv.pp.filter_and_normalize(shmeta1, min_shared_counts=30, n_top_genes=3000)
#scv.pp.filter_and_normalize(shmeta2, min_shared_counts=30, n_top_genes=3000)
scv.pp.moments(shmeta1)
scv.pp.moments(shmeta2)
WARNING: Did not normalize X as it looks processed already. To enforce normalization, set `enforce=True`.
Normalized count data: spliced, unspliced.
computing neighbors
finished (0:00:01) --> added
'distances' and 'connectivities', weighted adjacency matrices (adata.obsp)
computing moments based on connectivities
finished (0:00:04) --> added
'Ms' and 'Mu', moments of un/spliced abundances (adata.layers)
WARNING: Did not normalize X as it looks processed already. To enforce normalization, set `enforce=True`.
Normalized count data: spliced, unspliced.
computing neighbors
finished (0:00:00) --> added
'distances' and 'connectivities', weighted adjacency matrices (adata.obsp)
computing moments based on connectivities
finished (0:00:05) --> added
'Ms' and 'Mu', moments of un/spliced abundances (adata.layers)
In [49]:
scv.tl.recover_dynamics(shmeta1, n_jobs=96)
scv.tl.recover_dynamics(shmeta2, n_jobs=96)
recovering dynamics (using 96/96 cores)
0%| | 0/1562 [00:00<?, ?gene/s]
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/tools/dynamical_model.py:721: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. np.array([dm.alpha, dm.beta, dm.gamma, dm.pars[:3]]) / dm.m[-1] /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/tools/dynamical_model.py:724: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. np.array([dm.t, dm.tau, dm.t_, dm.pars[4]]) * dm.m[-1]
finished (0:01:45) --> added
'fit_pars', fitted parameters for splicing dynamics (adata.var)
recovering dynamics (using 96/96 cores)
0%| | 0/1199 [00:00<?, ?gene/s]
finished (0:01:07) --> added
'fit_pars', fitted parameters for splicing dynamics (adata.var)
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/tools/dynamical_model.py:721: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. np.array([dm.alpha, dm.beta, dm.gamma, dm.pars[:3]]) / dm.m[-1] /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/tools/dynamical_model.py:724: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. np.array([dm.t, dm.tau, dm.t_, dm.pars[4]]) * dm.m[-1]
In [50]:
scv.tl.velocity(shmeta1, mode='dynamical', n_jobs=96)
scv.tl.velocity(shmeta2, mode='dynamical', n_jobs=96)
computing velocities
finished (0:00:08) --> added
'velocity', velocity vectors for each individual cell (adata.layers)
computing velocities
finished (0:00:07) --> added
'velocity', velocity vectors for each individual cell (adata.layers)
In [51]:
scv.tl.velocity_graph(shmeta1, n_jobs=96)
scv.tl.velocity_graph(shmeta2, n_jobs=96)
computing velocity graph (using 96/96 cores)
0%| | 0/4168 [00:00<?, ?cells/s]
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/core/_parallelize.py:138: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. res = np.array(res) if as_array else res
finished (0:00:32) --> added
'velocity_graph', sparse matrix with cosine correlations (adata.uns)
computing velocity graph (using 96/96 cores)
0%| | 0/4506 [00:00<?, ?cells/s]
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/core/_parallelize.py:138: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. res = np.array(res) if as_array else res
finished (0:00:32) --> added
'velocity_graph', sparse matrix with cosine correlations (adata.uns)
In [52]:
scv.tl.latent_time(shmeta1)
scv.tl.latent_time(shmeta2)
computing terminal states
identified 4 regions of root cells and 1 region of end points .
finished (0:00:00) --> added
'root_cells', root cells of Markov diffusion process (adata.obs)
'end_points', end points of Markov diffusion process (adata.obs)
computing latent time using root_cells as prior
finished (0:00:04) --> added
'latent_time', shared time (adata.obs)
computing terminal states
identified 3 regions of root cells and 1 region of end points .
finished (0:00:01) --> added
'root_cells', root cells of Markov diffusion process (adata.obs)
'end_points', end points of Markov diffusion process (adata.obs)
computing latent time using root_cells as prior
finished (0:00:03) --> added
'latent_time', shared time (adata.obs)
In [53]:
scv.tl.velocity_confidence(shmeta1)
keys = 'velocity_length', 'velocity_confidence'
scv.pl.scatter(shmeta1, c=keys, cmap='coolwarm', perc=[5, 95])
scv.tl.velocity_confidence(shmeta2)
keys = 'velocity_length', 'velocity_confidence'
scv.pl.scatter(shmeta2, c=keys, cmap='coolwarm', perc=[5, 95])
--> added 'velocity_length' (adata.obs) --> added 'velocity_confidence' (adata.obs) --> added 'velocity_confidence_transition' (adata.obs)
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:869: MatplotlibDeprecationWarning: The draw_all function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use fig.draw_without_rendering() instead. cb.draw_all() /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:869: MatplotlibDeprecationWarning: The draw_all function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use fig.draw_without_rendering() instead. cb.draw_all()
--> added 'velocity_length' (adata.obs) --> added 'velocity_confidence' (adata.obs) --> added 'velocity_confidence_transition' (adata.obs)
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:869: MatplotlibDeprecationWarning: The draw_all function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use fig.draw_without_rendering() instead. cb.draw_all() /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:869: MatplotlibDeprecationWarning: The draw_all function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use fig.draw_without_rendering() instead. cb.draw_all()
In [54]:
df = shmeta1.obs.groupby('celltype')[keys].mean().T
df.style.background_gradient(cmap='coolwarm', axis=1)
Out[54]:
| celltype | AT2 - activated | AT2 - mature | AT2 intermediate | Aberrant intermediate | Proliferating | RASC-AT2 |
|---|---|---|---|---|---|---|
| velocity_length | 41.619279 | 34.521289 | 33.279471 | 36.225189 | 42.904032 | 42.157931 |
| velocity_confidence | 0.981757 | 0.725416 | 0.989794 | 0.988244 | 0.958688 | 0.942895 |
In [55]:
df2 = shmeta2.obs.groupby('celltype')[keys].mean().T
df2.style.background_gradient(cmap='coolwarm', axis=1)
Out[55]:
| celltype | AT2 - activated | AT2 - mature | AT2 intermediate | Aberrant intermediate | Proliferating | RASC-AT2 |
|---|---|---|---|---|---|---|
| velocity_length | 40.014214 | 37.214495 | 32.386285 | 31.449455 | 42.837100 | 40.050007 |
| velocity_confidence | 0.992140 | 0.790536 | 0.988956 | 0.976112 | 0.976596 | 0.938393 |
In [122]:
scv.pl.scatter(shmeta1, color='latent_time', color_map='gnuplot', size=80, save='VEH latent_time.pdf')
saving figure to file ./figures/scvelo_VEH latent_time.pdf
In [123]:
scv.pl.scatter(shmeta2, color='latent_time', color_map='gnuplot', size=80, save='PT latent_time.pdf')
saving figure to file ./figures/scvelo_PT latent_time.pdf
In [251]:
scv.pl.velocity_embedding_stream(shmeta1, basis='umap', color='celltype', title='', legend_loc='right margin', save='VEH_velo_20230822.pdf')
saving figure to file ./figures/scvelo_VEH_velo_20230822.pdf
In [253]:
scv.pl.velocity_embedding_stream(shmeta2, basis='umap', color='celltype', title='', legend_loc='right margin', save='PT_velo_20230822.svg')
saving figure to file ./figures/scvelo_PT_velo_20230822.svg
In [59]:
scv.tl.paga(shmeta1, groups='celltype', minimum_spanning_tree=False)
df = scv.get_df(shmeta1, 'paga/transitions_confidence', precision=5).T
df.style.background_gradient(cmap='Blues').format('{:.2g}')
running PAGA using priors: ['velocity_pseudotime']
finished (0:00:01) --> added
'paga/connectivities', connectivities adjacency (adata.uns)
'paga/connectivities_tree', connectivities subtree (adata.uns)
'paga/transitions_confidence', velocity transitions (adata.uns)
Out[59]:
| Â | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 1 | 0.69 | 0 | 0 | 0 | 0 | 0 |
| 2 | 0 | 0 | 0 | 0 | 0 | 0 |
| 3 | 0 | 0 | 0.36 | 0 | 0 | 0 |
| 4 | 0.44 | 0.22 | 0 | 0 | 0 | 0.33 |
| 5 | 0.62 | 0 | 0 | 0.27 | 0 | 0 |
In [60]:
scv.tl.paga(shmeta2, groups='celltype', minimum_spanning_tree=False)
df = scv.get_df(shmeta2, 'paga/transitions_confidence', precision=5).T
df.style.background_gradient(cmap='Blues').format('{:.2g}')
running PAGA using priors: ['velocity_pseudotime']
finished (0:00:01) --> added
'paga/connectivities', connectivities adjacency (adata.uns)
'paga/connectivities_tree', connectivities subtree (adata.uns)
'paga/transitions_confidence', velocity transitions (adata.uns)
Out[60]:
| Â | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0.5 |
| 1 | 0.2 | 0 | 0 | 0 | 0 | 0.84 |
| 2 | 0 | 0 | 0 | 0.039 | 0 | 0 |
| 3 | 0 | 0 | 0 | 0 | 0 | 0 |
| 4 | 0.4 | 0.26 | 0.038 | 0 | 0 | 0 |
| 5 | 0 | 0 | 0 | 0.14 | 0 | 0 |
In [250]:
scv.set_figure_params(style='scvelo', dpi=100, dpi_save=350, frameon=None, vector_friendly=True,
transparent=True, fontsize=7, figsize=(3,3),
format='pdf', ipython_format='png2x')
In [98]:
scv.pl.paga(shmeta1, threshold = 0.25, basis='umap', size=75, alpha=.1,
min_edge_width=2, node_size_scale=1.5, legend_loc='right',save='VEH PAGA alone_20230815.pdf')
WARNING: Invalid color key. Using grey instead. saving figure to file ./figures/scvelo_VEH PAGA alone_20230815.pdf
In [99]:
scv.pl.paga(shmeta2, threshold = 0.25, basis='umap', size=75, alpha=.1,
min_edge_width=2, node_size_scale=1.5, save='PT PAGA alone_20230815.pdf')
WARNING: Invalid color key. Using grey instead. saving figure to file ./figures/scvelo_PT PAGA alone_20230815.pdf
In [20]:
top_genes = shmeta1.var['fit_likelihood'].sort_values(ascending=False).index[:300]
scv.pl.heatmap(shmeta1, var_names=top_genes, sortby='latent_time', col_color='celltype', figsize=[3,4] , n_convolve=100)
In [21]:
top_genes = shmeta2.var['fit_likelihood'].sort_values(ascending=False).index[:300]
scv.pl.heatmap(shmeta2, var_names=top_genes, sortby='latent_time', col_color='celltype', figsize=[3,4] , n_convolve=100)
In [64]:
#shmeta1.write('./PT_velocity_RNA_scott_20230808_VEH_process.h5ad', compression='gzip')
In [65]:
#shmeta2.write('./PT_velocity_RNA_scott_20230808_PT_process.h5ad', compression='gzip')
In [4]:
shmeta1 = scv.read('./PT_velocity_RNA_scott_VEH_20230822.h5ad')
In [5]:
shmeta2 = scv.read('./PT_velocity_RNA_scott_PT_20230822.h5ad')
In [6]:
vk1 = cr.kernels.VelocityKernel(shmeta1)
vk2 = cr.kernels.VelocityKernel(shmeta2)
In [7]:
vk1.compute_transition_matrix(model = 'monte_carlo', n_jobs=-1)
vk2.compute_transition_matrix(model = 'monte_carlo', n_jobs=-1)
0%| | 0/4168 [00:00<?, ?cell/s]
0%| | 0/4168 [00:00<?, ?sample/s]
0%| | 0/4506 [00:00<?, ?cell/s]
0%| | 0/4506 [00:00<?, ?sample/s]
Out[7]:
VelocityKernel[n=4506, model='monte_carlo', similarity='correlation', softmax_scale=1.267, n_samples=1000, seed=None]
In [8]:
from cellrank.kernels import ConnectivityKernel
ck1 = cr.kernels.ConnectivityKernel(shmeta1)
ck1.compute_transition_matrix()
Out[8]:
ConnectivityKernel[n=4168, dnorm=True, key='connectivities']
In [9]:
ck2 = cr.kernels.ConnectivityKernel(shmeta2)
ck2.compute_transition_matrix()
Out[9]:
ConnectivityKernel[n=4506, dnorm=True, key='connectivities']
In [10]:
from cellrank.kernels import PseudotimeKernel
pk1 = PseudotimeKernel(shmeta1, time_key="latent_time")
pk1.compute_transition_matrix()
pk2 = PseudotimeKernel(shmeta2, time_key="latent_time")
pk2.compute_transition_matrix()
0%| | 0/4168 [00:00<?, ?cell/s]
0%| | 0/4506 [00:00<?, ?cell/s]
Out[10]:
PseudotimeKernel[n=4506, dnorm=False, scheme='hard', frac_to_keep=0.3]
In [11]:
pk1
Out[11]:
PseudotimeKernel[n=4168, dnorm=False, scheme='hard', frac_to_keep=0.3]
In [12]:
pk2
Out[12]:
PseudotimeKernel[n=4506, dnorm=False, scheme='hard', frac_to_keep=0.3]
In [13]:
combined_kernel_1 = 0.5 * vk1 + 0.5* ck1
In [14]:
combined_kernel_2 = 0.5 * vk2 + 0.5 * ck2
In [15]:
combined_kernel_1
Out[15]:
(0.5 * VelocityKernel[n=4168, model='monte_carlo', similarity='correlation', softmax_scale=1.278, n_samples=1000, seed=None] + 0.5 * ConnectivityKernel[n=4168, dnorm=True, key='connectivities'])
In [16]:
combined_kernel_2
Out[16]:
(0.5 * VelocityKernel[n=4506, model='monte_carlo', similarity='correlation', softmax_scale=1.267, n_samples=1000, seed=None] + 0.5 * ConnectivityKernel[n=4506, dnorm=True, key='connectivities'])
In [17]:
vk1.plot_projection(color="celltype", legend_loc='right margin', save='VEH cellrank trajectory_vk1_montecarlo_20230822.svg')
saving figure to file ./figures/scvelo_VEH cellrank trajectory_vk1_montecarlo_20230822.svg
In [18]:
combined_kernel_1.plot_projection(color="celltype", legend_loc='right margin', save='VEH cellrank trajectory_combinedKernal1_monteCarlo_20230822_final.pdf')
figure cannot be saved as pdf, using png instead. saving figure to file ./figures/scvelo_VEH cellrank trajectory_combinedKernal1_monteCarlo_20230822_final.png
In [19]:
vk2.plot_projection(color="celltype", legend_loc='right margin', save='PT cellrank trajectory_vk2_montecarlo_20230822.svg')
saving figure to file ./figures/scvelo_PT cellrank trajectory_vk2_montecarlo_20230822.svg
In [20]:
combined_kernel_2.plot_projection(color="celltype", legend_loc='right margin', save='PT cellrank trajectory_combinedKernal2_monte_carlo_20230822.pdf')
saving figure to file ./figures/scvelo_PT cellrank trajectory_combinedKernal2_monte_carlo_20230822.pdf
In [21]:
g1 = cr.estimators.GPCCA(vk1)
#g1 = cr.estimators.GPCCA(combined_kernel_1)
In [22]:
g2 = cr.estimators.GPCCA(vk2)
#g2 = cr.estimators.GPCCA(combined_kernel_2)
In [61]:
print(g1)
GPCCA[kernel=VelocityKernel[n=4168], initial_states=None, terminal_states=None]
In [62]:
g1.compute_schur()
g1.plot_spectrum(real_only=True)
WARNING: Unable to import `petsc4py` or `slepc4py`. Using `method='brandts'` WARNING: For `method='brandts'`, dense matrix is required. Densifying
In [65]:
g2.compute_schur()
g2.plot_spectrum(real_only=True)
WARNING: Unable to import `petsc4py` or `slepc4py`. Using `method='brandts'` WARNING: For `method='brandts'`, dense matrix is required. Densifying
In [25]:
#using n=3 states for veolcity analysis only with different predicted terminal states with veolocity kernal only
g1.fit(cluster_key="celltype", n_states=4)
#using n=7 for combined kernal analysis
#g1.fit(cluster_key="celltype", n_states=7)
g1.plot_macrostates(which="all", discrete=False, legend_loc="right")
g2.fit(cluster_key="celltype", n_states=4)
#g2.fit(cluster_key="celltype", n_states=7)
g2.plot_macrostates(which="all", discrete=False, legend_loc="right")
WARNING: Unable to import `petsc4py` or `slepc4py`. Using `method='brandts'` WARNING: For `method='brandts'`, dense matrix is required. Densifying
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter( /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter(
WARNING: Unable to import `petsc4py` or `slepc4py`. Using `method='brandts'` WARNING: For `method='brandts'`, dense matrix is required. Densifying
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter( /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter(
In [26]:
g1.plot_macrostates(which="all", discrete=False, legend_loc="right", save='VEH macrostates 8-22.pdf')
g2.plot_macrostates(which="all", discrete=False, legend_loc="right", save='PT macrostates 8-22.pdf')
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter( /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter(
saving figure to file ./figures/scvelo_VEH macrostates 8-22.pdf
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter( /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter(
saving figure to file ./figures/scvelo_PT macrostates 8-22.pdf
In [103]:
g1.predict_terminal_states()
#setting terminal states for n=7 states
#g1.set_terminal_states(states=["AT2 intermediate", "Aberrant intermediate", "AT2 - activated", "AT2 - mature"])
g1.plot_macrostates(which="terminal", legend_loc="right", s=100)
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter(
In [147]:
g1.plot_macrostates(which="terminal", discrete=False, add_outline=True, save = 'VEH terminal state prediction_outline.pdf')
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter( /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:1269: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored ax.scatter(x, y, s=bg_size, marker=".", c=bg_color, zorder=zord - 2, **kwargs) /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:1270: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored ax.scatter(x, y, s=gp_size, marker=".", c=gp_color, zorder=zord - 1, **kwargs) /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter( /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:1269: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored ax.scatter(x, y, s=bg_size, marker=".", c=bg_color, zorder=zord - 2, **kwargs) /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:1270: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored ax.scatter(x, y, s=gp_size, marker=".", c=gp_color, zorder=zord - 1, **kwargs) /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:1269: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap', 'vmin', 'vmax' will be ignored ax.scatter(x, y, s=bg_size, marker=".", c=bg_color, zorder=zord - 2, **kwargs) /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:1270: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap', 'vmin', 'vmax' will be ignored ax.scatter(x, y, s=gp_size, marker=".", c=gp_color, zorder=zord - 1, **kwargs)
saving figure to file ./figures/scvelo_VEH terminal state prediction_outline.pdf
In [105]:
g2.predict_terminal_states()
#g2.set_terminal_states(states=["AT2 intermediate_1", "Aberrant intermediate", "AT2 - activated", "AT2 - mature"])
g2.plot_macrostates(which="terminal", legend_loc="right", s=100)
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter(
In [148]:
g2.plot_macrostates(which="terminal", discrete=False, add_outline=True, save = 'PT terminal state prediction_outline.pdf')
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter( /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:1269: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored ax.scatter(x, y, s=bg_size, marker=".", c=bg_color, zorder=zord - 2, **kwargs) /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:1270: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored ax.scatter(x, y, s=gp_size, marker=".", c=gp_color, zorder=zord - 1, **kwargs) /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter( /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:1269: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored ax.scatter(x, y, s=bg_size, marker=".", c=bg_color, zorder=zord - 2, **kwargs) /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:1270: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored ax.scatter(x, y, s=gp_size, marker=".", c=gp_color, zorder=zord - 1, **kwargs) /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:1269: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap', 'vmin', 'vmax' will be ignored ax.scatter(x, y, s=bg_size, marker=".", c=bg_color, zorder=zord - 2, **kwargs) /home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/utils.py:1270: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap', 'vmin', 'vmax' will be ignored ax.scatter(x, y, s=gp_size, marker=".", c=gp_color, zorder=zord - 1, **kwargs)
saving figure to file ./figures/scvelo_PT terminal state prediction_outline.pdf
In [107]:
g1.predict_initial_states(allow_overlap=True)
g2.predict_initial_states(allow_overlap=True)
g1.plot_macrostates(which="initial", legend_loc="right", s=100)
g2.plot_macrostates(which="initial", legend_loc="right", s=100)
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter(
/home/mccalas1/miniconda3/envs/py3_10/lib/python3.10/site-packages/scvelo/plotting/scatter.py:614: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored smp = ax.scatter(
In [133]:
g1.compute_fate_probabilities()
g1.plot_fate_probabilities(same_plot=False, save = 'VEH abs fate probs.pdf')
0%| | 0/2 [00:00<?, ?/s]
saving figure to file ./figures/scvelo_VEH abs fate probs.pdf
In [134]:
g2.compute_fate_probabilities()
g2.plot_fate_probabilities(same_plot=False, save = 'PT abs fate probs.pdf')
0%| | 0/2 [00:00<?, ?/s]
saving figure to file ./figures/scvelo_PT abs fate probs.pdf
In [126]:
cr.pl.aggregate_fate_probabilities(
shmeta1,
mode="clustermap",
cluster_key="celltype",
save='VEH cluster abs prob.pdf'
)
In [127]:
cr.pl.aggregate_fate_probabilities(
shmeta2,
mode="clustermap",
cluster_key="celltype",
save='PT cluster abs prob.pdf'
)
In [145]:
delta_df = g1.compute_lineage_drivers(
lineages=["Aberrant intermediate"], cluster_key="celltype"
)
delta_df.head(30)
Out[145]:
| Aberrant intermediate_corr | Aberrant intermediate_pval | Aberrant intermediate_qval | Aberrant intermediate_ci_low | Aberrant intermediate_ci_high | |
|---|---|---|---|---|---|
| CA9 | 0.783764 | 0.0 | 0.0 | 0.771768 | 0.795202 |
| IGFBP2 | 0.738087 | 0.0 | 0.0 | 0.723950 | 0.751605 |
| NDRG1 | 0.727449 | 0.0 | 0.0 | 0.712832 | 0.741434 |
| HILPDA | 0.724418 | 0.0 | 0.0 | 0.709665 | 0.738535 |
| KISS1R | 0.692556 | 0.0 | 0.0 | 0.676418 | 0.708029 |
| TXNIP | 0.690897 | 0.0 | 0.0 | 0.674689 | 0.706439 |
| CLDN4 | 0.675117 | 0.0 | 0.0 | 0.658249 | 0.691308 |
| AKR7A3 | 0.648376 | 0.0 | 0.0 | 0.630426 | 0.665634 |
| CP | 0.646296 | 0.0 | 0.0 | 0.628263 | 0.663634 |
| TM4SF1 | 0.645281 | 0.0 | 0.0 | 0.627209 | 0.662659 |
| MT3 | 0.630905 | 0.0 | 0.0 | 0.612273 | 0.648838 |
| IGFBP5 | 0.625872 | 0.0 | 0.0 | 0.607047 | 0.643996 |
| SERPINA1 | 0.622676 | 0.0 | 0.0 | 0.603729 | 0.640920 |
| PGK1 | 0.613611 | 0.0 | 0.0 | 0.594323 | 0.632194 |
| ATF3 | 0.611519 | 0.0 | 0.0 | 0.592152 | 0.630179 |
| HMGB3 | 0.610797 | 0.0 | 0.0 | 0.591404 | 0.629484 |
| SOX4 | 0.610502 | 0.0 | 0.0 | 0.591097 | 0.629200 |
| JUN | 0.603691 | 0.0 | 0.0 | 0.584035 | 0.622639 |
| VIM | 0.599580 | 0.0 | 0.0 | 0.579774 | 0.618678 |
| WFDC2 | 0.597151 | 0.0 | 0.0 | 0.577256 | 0.616337 |
| TFF3 | 0.593412 | 0.0 | 0.0 | 0.573382 | 0.612734 |
| WDR86 | 0.588604 | 0.0 | 0.0 | 0.568401 | 0.608098 |
| TCIM | 0.586505 | 0.0 | 0.0 | 0.566227 | 0.606073 |
| TREM1 | 0.586390 | 0.0 | 0.0 | 0.566108 | 0.605963 |
| CDKN1C | 0.580961 | 0.0 | 0.0 | 0.560487 | 0.600726 |
| MUC20 | 0.572335 | 0.0 | 0.0 | 0.551558 | 0.592401 |
| ENO1 | 0.571917 | 0.0 | 0.0 | 0.551126 | 0.591998 |
| GPI | 0.563490 | 0.0 | 0.0 | 0.542409 | 0.583862 |
| BNIP3 | 0.561554 | 0.0 | 0.0 | 0.540407 | 0.581992 |
| ERO1A | 0.560882 | 0.0 | 0.0 | 0.539712 | 0.581343 |
In [146]:
delta_df.to_csv('Abberant lineage drivers 8-27.csv')
In [ ]:
In [26]:
model = cr.models.GAM(shmeta1)
cr.pl.gene_trends(
shmeta1,
model=model,
data_key="X",
genes=["VIM", "SCGB3A2", "SFTPC"],
lineages= "Aberrant intermediate",
ncols=3,
time_key="latent_time",
hide_cells=True,
figsize=(2, 3),
n_test_points=200,
save= 'vim_3A2_SFTPC model.pdf'
)
0%| | 0/3 [00:00<?, ?gene/s]
In [130]:
delta_df = g2.compute_lineage_drivers(
lineages=["AT2 intermediate"], cluster_key="celltype", clusters="RASC-AT2"
)
delta_df.head(20)
Out[130]:
| AT2 intermediate_corr | AT2 intermediate_pval | AT2 intermediate_qval | AT2 intermediate_ci_low | AT2 intermediate_ci_high | |
|---|---|---|---|---|---|
| CA9 | 0.434164 | 1.256992e-66 | 2.846585e-62 | 0.390305 | 0.476057 |
| PGK1 | 0.427839 | 1.761362e-64 | 1.994390e-60 | 0.383700 | 0.470026 |
| TFF3 | 0.415950 | 1.400733e-60 | 1.057367e-56 | 0.371299 | 0.458682 |
| PFKP | 0.413809 | 6.772110e-60 | 3.834030e-56 | 0.369067 | 0.456638 |
| CXCL17 | 0.411407 | 3.909683e-59 | 1.770774e-55 | 0.366563 | 0.454343 |
| FAM162A | 0.390655 | 7.812885e-53 | 2.948843e-49 | 0.344964 | 0.434498 |
| WFDC2 | 0.376066 | 1.089926e-48 | 3.085309e-45 | 0.329808 | 0.420522 |
| ENO1 | 0.371707 | 1.705125e-47 | 4.290473e-44 | 0.325285 | 0.416342 |
| HILPDA | 0.365580 | 7.548058e-46 | 1.709333e-42 | 0.318930 | 0.410463 |
| BNIP3 | 0.363883 | 2.123106e-45 | 4.370896e-42 | 0.317170 | 0.408834 |
| GAPDH | 0.363365 | 2.905914e-45 | 5.483944e-42 | 0.316634 | 0.408337 |
| ASCL1 | 0.362543 | 4.780795e-45 | 8.328144e-42 | 0.315781 | 0.407547 |
| LDHA | 0.360167 | 1.996287e-44 | 3.229136e-41 | 0.313319 | 0.405266 |
| CLDN3 | 0.359456 | 3.053904e-44 | 4.610580e-41 | 0.312582 | 0.404583 |
| TPI1 | 0.352559 | 1.777196e-42 | 2.515399e-39 | 0.305439 | 0.397958 |
| PKM | 0.348492 | 1.856975e-41 | 2.473709e-38 | 0.301228 | 0.394048 |
| MIF | 0.341220 | 1.124813e-39 | 1.415140e-36 | 0.293705 | 0.387053 |
| SCD | 0.325403 | 5.699539e-36 | 6.146274e-33 | 0.277362 | 0.371821 |
| CST3 | 0.324671 | 8.348704e-36 | 8.593853e-33 | 0.276607 | 0.371116 |
| XBP1 | 0.321878 | 3.550330e-35 | 3.495686e-32 | 0.273723 | 0.368422 |
In [146]:
shmeta1.write('./PT_velocity_RNA_scott_VEH_20230822.h5ad', compression='gzip')
In [147]:
shmeta2.write('./PT_velocity_RNA_scott_PT_20230822.h5ad', compression='gzip')
In [84]:
model = cr.models.GAM(shmeta1, n_knots=6)
cr.pl.gene_trends(
shmeta1,
model=model,
data_key="X",
genes=["VIM", "SCGB3A2", "SFTPC"],
ncols=1,
time_key="latent_time",
same_plot=True,
hide_cells=True,
figsize=(4, 8),
n_test_points=200,
)
0%| | 0/3 [00:00<?, ?gene/s]